﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using CinemaDbLib;
using CinemaProject;

namespace CinamaProject
{
    public class TicketCtrl : WcfServiceLibrary1.Ctrl.ITicketCtrl
    {
        private TicketDB ticketDB;

        public TicketCtrl()
        {
            ticketDB = new TicketDB();
        }

        public int addTicket(Ticket ticket)
        {
            return ticketDB.insertTicket(ticket);
        }

        public bool removeTicket(string id)
        {
            return ticketDB.removeTicket(Convert.ToInt32(id));
        }

        public bool updateTicket(Ticket ticket)
        {
            return ticketDB.updateTicket(ticket);
        }

        public Ticket getTicketById(string id)
        {
            return ticketDB.getTicketById(Convert.ToInt32(id));
        }

        public List<Ticket> getTickets()
        {
            return ticketDB.getTickets();
        }

        public List<Ticket> getTicketsBySchedule(int scheduleId)
        {
            return ticketDB.getTicketsBySchedule(scheduleId);
        }
    }
}